// 流:stream : 瀑布、流水
//nodejs里会在数据传递的时候把数据分成64k的小方块来进行传递
//读取文件，html 8g内存读取10g文件 会down机 会村会溢出

const fs = require("fs");
let buffer64 = Buffer.alloc(1024 * 64);
fs.writeFileSync("64k", buffer64)

let rs = fs.createReadStream("./1.txt");
let num = 0;

let str = "";

rs.on("data", chunk => {
    str += chunk;
    num++;
})

rs.on("end", () => {
    console.log(num);
    console.log(str);


})